import 'package:flutter_test/flutter_test.dart';
import 'package:lib_bt/lib_bt.dart';
import 'package:lib_bt/lib_bt_platform_interface.dart';
import 'package:lib_bt/lib_bt_method_channel.dart';
import 'package:lib_bt/listener/OnBleConnectListener.dart';
import 'package:lib_bt/listener/OnBleDataListener.dart';
import 'package:lib_bt/listener/OnBleScanListener.dart';
import 'package:lib_bt/listener/OnOtaListener.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockLibBtPlatform
    with MockPlatformInterfaceMixin
    implements LibBtPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<T?> invokeMethod<T>(String method, [arguments]) {
    // TODO: implement invokeMethod
    throw UnimplementedError();
  }


  @override
  void setOnBleConnectListener(OnBleConnectListener listener) {
  }

  @override
  void setOnBleScanListener(OnBleScanListener listener) {
  }

  @override
  void setOnOtaListener(OnOtaListener listener) {
  }

  @override
  void setOnBleDataListener(OnBleDataListener listener) {
  }
}

void main() {
  final LibBtPlatform initialPlatform = LibBtPlatform.instance;

  test('$MethodChannelLibBt is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelLibBt>());
  });

  test('getPlatformVersion', () async {
    LibBt libBtPlugin = LibBt();
    MockLibBtPlatform fakePlatform = MockLibBtPlatform();
    LibBtPlatform.instance = fakePlatform;

    expect(await libBtPlugin.getPlatformVersion(), '42');
  });
}
